home *** CD-ROM | disk | FTP | other *** search
/ Comix Games / Comix Games.iso / waldo / waldo.exe / FINAL08.DXR / 00258.ls < prev    next >
Encoding:
Text File  |  1995-10-08  |  7.4 KB  |  173 lines

  1. on @ whichSprite
  2.   if the type of sprite whichSprite = 0 then
  3.     put "There is no sprite in channel " & whichSprite & "."
  4.   else
  5.     set item1 to "Sprite loc: " & point(the locH of sprite whichSprite, the locV of sprite whichSprite)
  6.     set centerH to ((the right of sprite whichSprite - the left of sprite whichSprite) / 2) + the left of sprite whichSprite
  7.     set centerV to ((the bottom of sprite whichSprite - the top of sprite whichSprite) / 2) + the top of sprite whichSprite
  8.     set item2 to "   Sprite center: " & point(centerH, centerV)
  9.     put item1 & item2
  10.   end if
  11. end
  12.  
  13. on ? whichSprite
  14.   if the type of sprite whichSprite = 0 then
  15.     put "There is no sprite in channel " & whichSprite & "."
  16.   else
  17.     set whichCast to the castNum of sprite whichSprite
  18.     set whichCastName to whichCast
  19.     if the name of cast whichCast > 0 then
  20.       set whichCastName to QUOTE & the name of cast whichCast & QUOTE
  21.     end if
  22.     set item1 to "Sprite: " & whichSprite & "   Cast: " & whichCastName & "   Type: " & the type of sprite whichSprite
  23.     set item1 to item1 & ", " & the castType of cast whichCast
  24.     set item2 to "   Ink: " & the ink of sprite whichSprite
  25.     set item3 to "   Sprite loc: " & point(the locH of sprite whichSprite, the locV of sprite whichSprite)
  26.     set item4 to "   Top left corner: " & point(the left of sprite whichSprite, the top of sprite whichSprite)
  27.     set item5 to "   Bottom right corner: " & point(the right of sprite whichSprite, the bottom of sprite whichSprite)
  28.     set item6 to "   Stretch: " & the stretch of sprite whichSprite & "   Cursor: " & the cursor of sprite whichSprite
  29.     set item7 to RETURN & RETURN & "To activate sprite [ whichSprite ] , copy this into your script:    "
  30.     set item8 to "activate [ whichSprite ] , " & whichCastName & ", " & the type of sprite whichSprite & ", " & the ink of sprite whichSprite & ", "
  31.     if the stretch of sprite whichSprite = 0 then
  32.       set item9 to the locH of sprite whichSprite & ", " & the locV of sprite whichSprite & ", "
  33.       set item9 to item9 & QUOTE & QUOTE & ", " & QUOTE & QUOTE & ", " & QUOTE
  34.     else
  35.       set item9 to the left of sprite whichSprite & ", " & the top of sprite whichSprite & ", " & QUOTE & "stretch to:" & QUOTE & ", "
  36.       set item9 to item9 & the right of sprite whichSprite & ", " & the bottom of sprite whichSprite & RETURN
  37.     end if
  38.     put item1 & item2 & item3 & item4 & item5 & item6 & item7 & item8 & item9
  39.   end if
  40. end
  41.  
  42. on ! whichSprite
  43.   if value(whichSprite) > 0 then
  44.     if the type of sprite whichSprite = 0 then
  45.       put "Cursor location: " & point(the mouseH, the mouseV)
  46.       put "There is no sprite in channel " & whichSprite & "."
  47.     else
  48.       put "Cursor location: " & point(the mouseH, the mouseV)
  49.       set item1 to "Cursor location, relative to the top left corner of sprite " & whichSprite & ": "
  50.       set item2 to point(the mouseH - the left of sprite whichSprite, the mouseV - the top of sprite whichSprite)
  51.       put item1 & item2
  52.     end if
  53.   else
  54.     put "Cursor location: " & point(the mouseH, the mouseV)
  55.   end if
  56. end
  57.  
  58. on setActivateScript whichSprite, whichSprite2
  59.   if the type of sprite whichSprite = 0 then
  60.     set activateScript to "nothing"
  61.   else
  62.     set whichCast to the castNum of sprite whichSprite
  63.     set whichCastName to whichCast
  64.     if the name of cast whichCast > 0 then
  65.       set whichCastName to QUOTE & the name of cast whichCast & QUOTE
  66.     end if
  67.     set item8 to "activate " & whichSprite2 & ", " & whichCastName & ", " & the type of sprite whichSprite & ", " & the ink of sprite whichSprite & ", "
  68.     if the stretch of sprite whichSprite = 0 then
  69.       set item9 to the locH of sprite whichSprite & ", " & the locV of sprite whichSprite & ", "
  70.       set item9 to item9 & QUOTE & QUOTE & ", " & QUOTE & QUOTE & ", " & QUOTE & QUOTE
  71.     else
  72.       set item9 to the left of sprite whichSprite & ", " & the top of sprite whichSprite & ", " & QUOTE & "stretch to:" & QUOTE & ", "
  73.       set item9 to item9 & the right of sprite whichSprite & ", " & the bottom of sprite whichSprite
  74.     end if
  75.     set activateScript to item8 & item9
  76.   end if
  77.   return activateScript
  78. end
  79.  
  80. on activate whichSprite, targetCast, targetType, targetInk, targetH, targetV, stretchBool, targetH2, targetV2
  81.   puppetSprite(whichSprite, 1)
  82.   set the type of sprite whichSprite to targetType
  83.   set the castNum of sprite whichSprite to the number of cast targetCast
  84.   set the ink of sprite whichSprite to targetInk
  85.   set the foreColor of sprite whichSprite to 255
  86.   set the backColor of sprite whichSprite to 0
  87.   set the locH of sprite whichSprite to targetH
  88.   set the locV of sprite whichSprite to targetV
  89.   if stretchBool = EMPTY then
  90.     set the stretch of sprite whichSprite to 0
  91.   else
  92.     set the stretch of sprite whichSprite to 1
  93.     if targetH2 <> EMPTY then
  94.       spriteBox(whichSprite, targetH, targetV, targetH2, targetV2)
  95.     end if
  96.   end if
  97.   set the immediate of sprite whichSprite to 1
  98. end
  99.  
  100. on deactivate spriteList
  101.   if listp(spriteList) then
  102.     set repeatLimit to count(spriteList)
  103.     repeat with theCount = 1 to repeatLimit
  104.       set whichSprite to getAt(spriteList, 1)
  105.       set the type of sprite whichSprite to 0
  106.       puppetSprite(whichSprite, 0)
  107.       deleteAt(spriteList, 1)
  108.     end repeat
  109.   end if
  110. end
  111.  
  112. on store spriteList
  113.   global gStoredSpriteInfo
  114.   if listp(spriteList) then
  115.     if not listp(gStoredSpriteInfo) then
  116.       set gStoredSpriteInfo to []
  117.     end if
  118.     set repeatLimit to count(spriteList)
  119.     repeat with theCount = 1 to repeatLimit
  120.       set x to getAt(spriteList, 1)
  121.       set spriteXinfo to [the type of sprite x]
  122.       if the type of sprite x > 0 then
  123.         append(spriteXinfo, the puppet of sprite x)
  124.         append(spriteXinfo, the castNum of sprite x)
  125.         append(spriteXinfo, the ink of sprite x)
  126.         append(spriteXinfo, the foreColor of sprite x)
  127.         append(spriteXinfo, the backColor of sprite x)
  128.         append(spriteXinfo, the locH of sprite x)
  129.         append(spriteXinfo, the locV of sprite x)
  130.         if the castType of cast the castNum of sprite x = #digitalVideo then
  131.           append(spriteXinfo, the movieTime of sprite x)
  132.           append(spriteXinfo, the movieRate of sprite x)
  133.         end if
  134.       end if
  135.       setAt(gStoredSpriteInfo, x, spriteXinfo)
  136.       deleteAt(spriteList, 1)
  137.     end repeat
  138.   end if
  139. end
  140.  
  141. on restore spriteList
  142.   global gStoredSpriteInfo
  143.   if listp(spriteList) then
  144.     if not listp(gStoredSpriteInfo) then
  145.       set gStoredSpriteInfo to []
  146.     end if
  147.     set repeatLimit to count(spriteList)
  148.     repeat with theCount = 1 to repeatLimit
  149.       set x to getAt(spriteList, 1)
  150.       if count(gStoredSpriteInfo) >= x then
  151.         set spriteXinfo to getAt(gStoredSpriteInfo, x)
  152.         if listp(spriteXinfo) then
  153.           set the type of sprite x to getAt(spriteXinfo, 1)
  154.           if getAt(spriteXinfo, 1) > 0 then
  155.             set the puppet of sprite x to getAt(spriteXinfo, 2)
  156.             set the castNum of sprite x to getAt(spriteXinfo, 3)
  157.             set the ink of sprite x to getAt(spriteXinfo, 4)
  158.             set the foreColor of sprite x to getAt(spriteXinfo, 5)
  159.             set the backColor of sprite x to getAt(spriteXinfo, 6)
  160.             set the locH of sprite x to getAt(spriteXinfo, 7)
  161.             set the locV of sprite x to getAt(spriteXinfo, 8)
  162.             if count(spriteXinfo) >= 10 then
  163.               set the movieTime of sprite x to getAt(spriteXinfo, 9)
  164.               set the movieRate of sprite x to getAt(spriteXinfo, 10)
  165.             end if
  166.           end if
  167.         end if
  168.       end if
  169.       deleteAt(spriteList, 1)
  170.     end repeat
  171.   end if
  172. end
  173.